/**
 * 
 */
package es.ibm.santillana.mdm.postprocessing.catalog;

import com.ibm.pim.catalog.item.Item;
import com.ibm.pim.collaboration.CollaborationItem;
import com.ibm.pim.collaboration.CollaborationStep;
import com.ibm.pim.extensionpoints.CategoryPrePostProcessingFunctionArguments;
import com.ibm.pim.extensionpoints.CollaborationCategoryPrePostProcessingFunctionArguments;
import com.ibm.pim.extensionpoints.CollaborationItemPrePostProcessingFunctionArguments;
import com.ibm.pim.extensionpoints.ItemPrePostProcessingFunctionArguments;
import com.ibm.pim.extensionpoints.PrePostProcessingFunction;
import com.ibm.pim.utils.Logger;

import es.ibm.santillana.mdm.common.bussinesmodel.BussinesRules;
import es.ibm.santillana.mdm.common.util.ItemUtils;
import es.ibm.santillana.mdm.common.util.SantillanaLogger;

/**
 * @author Benito
 *
 */
public abstract class CatalogGenericPostProcessing implements
		PrePostProcessingFunction {

	

	/**
	 * 
	 */
	public CatalogGenericPostProcessing() {
		// TODO Auto-generated constructor stub
	}
	/* (non-Javadoc)
	 * @see com.ibm.pim.extensionpoints.PrePostProcessingFunction#prePostProcessing(com.ibm.pim.extensionpoints.CategoryPrePostProcessingFunctionArguments)
	 */
	public void finishPostProcessing(ItemPrePostProcessingFunctionArguments arg0) {
		Item itm = arg0.getItem();
		com.ibm.pim.catalog.Catalog ctg = itm.getCatalog();
		Logger log = SantillanaLogger.getLogger();
		log.logInfo("*******Finalizando en el PostProcessing del catalogo '" + ctg.getName() + "' con el item  '" + itm.getPrimaryKey() + "'");

	}

	/* (non-Javadoc)
	 * @see com.ibm.pim.extensionpoints.PrePostProcessingFunction#prePostProcessing(com.ibm.pim.extensionpoints.ItemPrePostProcessingFunctionArguments)
	 */
	@Override
	public void prePostProcessing(ItemPrePostProcessingFunctionArguments arg0) {
		Item itm = arg0.getItem();
		Logger log = SantillanaLogger.getLogger();
		
		
		log.logInfo("*******Entrando en el PostProcessing del catalogo '" + itm.getCatalog().getName() + "' con el item  '" + itm.getPrimaryKey() + "'");
		
		

	}

	/* (non-Javadoc)
	 * @see com.ibm.pim.extensionpoints.PrePostProcessingFunction#prePostProcessing(com.ibm.pim.extensionpoints.CategoryPrePostProcessingFunctionArguments)
	 */
	@Override
	public void prePostProcessing(
			CategoryPrePostProcessingFunctionArguments arg0) {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see com.ibm.pim.extensionpoints.PrePostProcessingFunction#prePostProcessing(com.ibm.pim.extensionpoints.CollaborationItemPrePostProcessingFunctionArguments)
	 */
	@Override
	public void prePostProcessing(
			CollaborationItemPrePostProcessingFunctionArguments arg0) {
		String colArea = arg0.getCollaborationItem().getCollaborationArea().getName();
		CollaborationItem itm =  arg0.getCollaborationItem();
		CollaborationStep step = arg0.getCollaborationStep();
		String stepName = "";
		Logger log = SantillanaLogger.getLogger();
		if (step != null) {
			stepName = step.getName();
		}
		log.logInfo("*******Entrando en el PostProcessing del area de colaboracion '" + colArea + "' con el item  '" + itm.getPrimaryKey() + "' en el step '" + stepName + "'");


	}
	
	public void finishPostProcessing(CollaborationItemPrePostProcessingFunctionArguments arg0) {
		String colArea = arg0.getCollaborationItem().getCollaborationArea().getName();
		CollaborationItem itm =  arg0.getCollaborationItem();
		Logger log = SantillanaLogger.getLogger();
		CollaborationStep step = arg0.getCollaborationStep();
		String stepName = "";
		
		if (step != null) {
			stepName = step.getName();
		}
		log.logInfo("*******Finalizando en el PostProcessing del area de colaboracion '" + colArea + "' con el item  '" + itm.getPrimaryKey() + "' en el step '" + stepName + "'");

	}

	/* (non-Javadoc)
	 * @see com.ibm.pim.extensionpoints.PrePostProcessingFunction#prePostProcessing(com.ibm.pim.extensionpoints.CollaborationCategoryPrePostProcessingFunctionArguments)
	 */
	@Override
	public void prePostProcessing(
			CollaborationCategoryPrePostProcessingFunctionArguments arg0) {
		// TODO Auto-generated method stub

	}

}
